package com.cuzz.springmvc.controller;


import com.cuzz.springmvc.plugin.simpleexcel.ExcelExport;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@RequestMapping
@ResponseBody
@Controller
public class MyController {


    @PostMapping("/listUser")
    @ExcelExport(path = "/exportUser",fileName = "1.xls",sheetName = "1")
    public List<UserVO> listUser(){
        return doListUser();
    }


    private List<UserVO> doListUser(){
        ArrayList<UserVO> userVOS = new ArrayList<>();
        userVOS.add(new UserVO(1,"1"));
        userVOS.add(new UserVO(2,"2"));
        return userVOS;
    }
}
